import { PayloadAction, createSlice } from '@reduxjs/toolkit';

export interface Position {
    longitude: number;
    latitude: number;
    height: number;
}

interface SceneState {
    cesium3D: boolean;
    initPosition: Position;
}

const initialState: SceneState = {
    cesium3D: true,
    initPosition: {
        longitude: 116.39,
        latitude: 39.91,
        height: 10000,
    },
};

export const sceneSlice = createSlice({
    name: 'scene',
    initialState: initialState,
    reducers: {
        updateCesium3D(state, action: PayloadAction<boolean>) {
            state.cesium3D = action.payload;
        },
    },
});

export const { updateCesium3D } = sceneSlice.actions;

export default sceneSlice.reducer;
